home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gpcheck.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.3 KB  |  59 lines

  1. /* Copyright (C) 1992, 1994 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gpcheck.h,v 1.2 2000/09/19 19:00:25 lpd Exp $ */
  20. /* Interrupt check interface */
  21.  
  22. #ifndef gpcheck_INCLUDED
  23. #  define gpcheck_INCLUDED
  24.  
  25. /*
  26.  * On some platforms, the interpreter must check periodically for user-
  27.  * initiated actions.  (Eventually, this may be extended to all platforms,
  28.  * to handle multi-tasking through the 'context' facility.)  Routines that
  29.  * run for a long time must periodically call gp_check_interrupts(), and
  30.  * if it returns true, must clean up whatever they are doing and return an
  31.  * e_interrupted (or gs_error_interrupted) exceptional condition.
  32.  * The return_if_interrupt macro provides a convenient way to do this.
  33.  *
  34.  * On platforms that require an interrupt check, the makefile defines
  35.  * a symbol CHECK_INTERRUPTS.  Currently this is only the Microsoft
  36.  * Windows platform.
  37.  */
  38. int gs_return_check_interrupt(P1(int code));
  39.  
  40. #ifdef CHECK_INTERRUPTS
  41. int gp_check_interrupts(P0());
  42. #  define process_interrupts() discard(gp_check_interrupts())
  43. #  define return_if_interrupt()\
  44.     { int icode_ = gp_check_interrupts();\
  45.       if ( icode_ )\
  46.     return gs_note_error((icode_ > 0 ? gs_error_interrupt : icode_));\
  47.     }
  48. #  define return_check_interrupt(code)\
  49.     return gs_return_check_interrupt(code)
  50. #else
  51. #  define gp_check_interrupts() 0
  52. #  define process_interrupts() DO_NOTHING
  53. #  define return_if_interrupt()    DO_NOTHING
  54. #  define return_check_interrupt(code)\
  55.     return (code)
  56. #endif
  57.  
  58. #endif /* gpcheck_INCLUDED */
  59.